package com.ie.controller.before;

import com.ie.comment.http.ResponseResult;
import com.ie.comment.sercurity.anno.AuthIgrone;
import com.ie.entity.CartEntity;
import com.ie.sevice.admin.GoodsService;
import com.ie.sevice.before.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/before/cart")
public class CartController {

    @Autowired
    private CartService cartService;

    @Autowired
    private GoodsService goodsService;


    @AuthIgrone
    @PostMapping("/add")
    public ResponseResult<Map<String,Object>> addCart(@RequestBody CartEntity cartEntity){

        return cartService.addCart(cartEntity);
    }

    @AuthIgrone
    @PostMapping("/bupDateCart")
    public ResponseResult<Map<String,Object>> bupDateCart(@RequestBody CartEntity cartEntity){

        return cartService.bupDateCart(cartEntity);
    }

    @AuthIgrone
    @PostMapping("/clearCart")
    public ResponseResult<Map<String,Object>> clearCart(@RequestBody CartEntity cartEntity){
        return cartService.clearCart(cartEntity);
    }


}